

public class Util {
		/**
		 * This function removes all conjunctions and anything that is not a valid
		 * variable.
		 * 
		 * @param str
		 *            string that will have white spaces removed
		 * @return String with all valid variable names.
		 */
		public static String removeJunk(String str) {

			// Removes n't off words.
			str = str.replaceAll("n\'t\\s", " ");
			// Removes '* words from the string
			str = str.replaceAll("\'\\w\\s", " ");
			// Removes '** words from the string
			str = str.replaceAll("\'\\w\\w\\s", " ");

			// Removes characters that arn't [a-z][A-Z][0-9]'_' '$'
			StringBuilder sb = new StringBuilder();
			sb.append(" ");
			for (int i = 0; i < str.length(); i++) {
				if (Character.isLetterOrDigit(str.charAt(i))
						|| str.charAt(i) == '$' || str.charAt(i) == '_') {
					sb.append(str.charAt(i));
				} else
					sb.append("  ");
			}
			sb.append("  ");
			// Makes every thing lower case
			str = sb.toString().toLowerCase();
			// Removes all stand alone digits from the String.
			str = str.replaceAll("\\s\\d+\\s", " ");
			// Removes all extra white spaces.
			str = str.replaceAll("\\s\\s+|\\n\\r|\\n", " ");
			// Trims the sentence.
			str = str.trim();

			return str;
		}
}